*********************
*Prepare the dataset*
*********************

*Load data

*Clean data
summarize
drop participantcode participantlabel participant_is_bot participant_index_in_pages participanttime_started_utc participantvisited participantmturk_worker_id participantmturk_assignment_id participantpayoff playerrole playervote playervote_2 playerpaying_round playerparticipation_fee playertotal_payoff grouprand_selected groupcolor1 groupcolor2 groupcolor3 groupcolor_prop groupcolor_prop_2 grouppaying_round_indicator groupvote1 groupvote2 groupvote3 groupvote1_2 groupvote2_2 groupvote3_2 groupagreement_1 sessioncode sessionlabel sessionmturk_HITId sessionmturk_HITGroupId sessioncomment sessionis_demo
drop participant_max_page_index participant_current_app_name participant_current_page_name

rename participantid_in_session id
rename playerid_in_group id_in_group
rename playerbid_role bid_role
rename playerbid bid
rename playerbid_paid bid_paid
rename playerprob_role1 prob_role1
rename playerprob_role2 prob_role2
rename playerprob_role3 prob_role3
rename playerselected selected
rename playeroffer_to_1 offer_to_1
rename playeroffer_to_2 offer_to_2
rename playeroffer_to_3 offer_to_3
rename playeroffer_to_1_2 offer_to_1_2
rename playeroffer_to_2_2 offer_to_2_2
rename playeroffer_to_3_2 offer_to_3_2
rename playervote_no vote_no
rename playervote_no_2 vote_no_2 
rename playerpaying_round_indicator paying_round_indicator
rename subsessionround_number round
rename selected selected_bid_paid
rename Treatment treatment
rename Session session
rename groupproposer proposer
rename groupproposer_2 proposer_2
rename groupchosen_offer_to_1 chosen_offer_to_1
rename groupchosen_offer_to_2 chosen_offer_to_2
rename groupchosen_offer_to_3 chosen_offer_to_3
rename groupchosen_offer_to_1_2 chosen_offer_to_1_2
rename groupchosen_offer_to_2_2 chosen_offer_to_2_2
rename groupchosen_offer_to_3_2 chosen_offer_to_3_2
rename groupallocation_to_1 allocation_to_1
rename groupallocation_to_2 allocation_to_2
rename groupallocation_to_3 allocation_to_3
rename groupallocation_to_1_2 allocation_to_1_2
rename groupallocation_to_2_2 allocation_to_2_2
rename groupallocation_to_3_2 allocation_to_3_2
rename groupauc_round auc_round
rename groupauc_endowment auc_endowment
rename groupid_in_subsession group

gen subject_id = 1000*treatment + 100*session + id
order round, before(id)
order subject_id, after(id)
gen vote = 1-vote_no
gen vote_2 = 1-vote_no_2
gen budget = 60
gen prob1 = 0.36
gen prob2 = 0.33
gen prob3 = 0.31
gen prob1_2 = 0.36 
gen prob2_2 = 0.33 
gen prob3_2 = 0.31
replace prob1_2 = 0.70 if treatment ==2
replace prob2_2 = 0.26 if treatment ==2
replace prob3_2 = 0.04 if treatment ==2

*Label treatments
label define treatment_name 1 "Baseline" 2 "Modified Period2 " 3 "Auto Period2" 4 "Auto Vote"
label values treatment treatment_name

*Check the # of subjects & observations
bysort treatment session: count if round== 1
*198 subjects, 5940 observations

*Save as cleaned dataset

**********************
*Analyses - main text*
**********************

***Preparation for the analyses
 
*Define minimal winning coalition and grand coalition
gen mwc=0
gen mwc2=.
gen gc=0
gen gc2=.
gen self=0
gen self2=.
gen other=0
gen other2=.
replace mwc2=0 if offer_to_1_2 !=. & offer_to_2_2 !=.& offer_to_3_2 !=.
replace gc2=0 if offer_to_1_2 !=. & offer_to_2_2 !=.& offer_to_3_2 !=.
replace self2=0 if offer_to_1_2 !=. & offer_to_2_2 !=.& offer_to_3_2 !=.
replace other2=0 if offer_to_1_2 !=. & offer_to_2_2 !=.& offer_to_3_2 !=.

replace mwc=1 if id_in_group==1 & offer_to_1 > 0 &  offer_to_1 < 60  & offer_to_2*offer_to_3 == 0
replace mwc=1 if id_in_group==2 & offer_to_2 > 0 &  offer_to_2 < 60  & offer_to_1*offer_to_3 == 0
replace mwc=1 if id_in_group==3 & offer_to_3 > 0 &  offer_to_3 < 60  & offer_to_1*offer_to_2 == 0
replace mwc2=1 if id_in_group==1 & offer_to_1_2 > 0 &  offer_to_1_2 < 60  & offer_to_2_2*offer_to_3_2 == 0
replace mwc2=1 if id_in_group==2 & offer_to_2_2 > 0 &  offer_to_2_2 < 60  & offer_to_1_2*offer_to_3_2 == 0
replace mwc2=1 if id_in_group==3 & offer_to_3_2 > 0 &  offer_to_3_2 < 60  & offer_to_1_2*offer_to_2_2 == 0
replace gc=1 if offer_to_1*offer_to_2*offer_to_3 > 0
replace gc2=1 if offer_to_1_2 !=. & offer_to_2_2 !=.& offer_to_3_2 !=. & offer_to_1_2*offer_to_2_2*offer_to_3_2 > 0
replace self=1 if id_in_group==1 & offer_to_1 == 60
replace self=1 if id_in_group==2 & offer_to_2 == 60
replace self=1 if id_in_group==3 & offer_to_3 == 60
replace self2=1 if id_in_group==1 & offer_to_1_2 == 60
replace self2=1 if id_in_group==2 & offer_to_2_2 == 60
replace self2=1 if id_in_group==3 & offer_to_3_2 == 60
replace other=1 if mwc==0 & gc==0 & self==0
replace other2=1 if other2==0 & mwc2==0 & gc2==0 & self2==0

*Alternative definition of minimal winning coalition and grand coalition : continuation value criterion
gen mwci=0
gen gci=0
gen selfi=0
gen otheri=0
replace mwci=1 if id_in_group==1 & offer_to_1 > 0 &  offer_to_1 < 60  & offer_to_2 >= prob2*budget & offer_to_3 < prob3*budget
replace mwci=1 if id_in_group==1 & offer_to_1 > 0 &  offer_to_1 < 60  & offer_to_2 < prob2*budget & offer_to_3 >= prob3*budget
replace mwci=1 if id_in_group==2 & offer_to_2 > 0 &  offer_to_2 < 60  & offer_to_1 >= prob1*budget & offer_to_3 < prob3*budget
replace mwci=1 if id_in_group==2 & offer_to_2 > 0 &  offer_to_2 < 60  & offer_to_1 < prob1*budget & offer_to_3 >= prob3*budget
replace mwci=1 if id_in_group==3 & offer_to_3 > 0 &  offer_to_3 < 60  & offer_to_1 >= prob1*budget & offer_to_2 < prob2*budget
replace mwci=1 if id_in_group==3 & offer_to_3 > 0 &  offer_to_3 < 60  & offer_to_1 < prob1*budget & offer_to_2 >= prob2*budget
replace gci=1 if id_in_group==1 & offer_to_1 > 0 &  offer_to_1 < 60  & offer_to_2 >= prob2*budget & offer_to_3 >= prob3*budget
replace gci=1 if id_in_group==2 & offer_to_2 > 0 &  offer_to_2 < 60  & offer_to_1 >= prob1*budget & offer_to_3 >= prob3*budget
replace gci=1 if id_in_group==3 & offer_to_3 > 0 &  offer_to_3 < 60  & offer_to_1 >= prob1*budget & offer_to_2 >= prob2*budget
replace selfi=1 if id_in_group==1 & offer_to_1 > 0 &  offer_to_1 < 60  & offer_to_2 < prob2*budget & offer_to_3 < prob3*budget
replace selfi=1 if id_in_group==2 & offer_to_2 > 0 &  offer_to_2 < 60  & offer_to_1 < prob1*budget & offer_to_3 < prob3*budget
replace selfi=1 if id_in_group==3 & offer_to_3 > 0 &  offer_to_3 < 60  & offer_to_1 < prob1*budget & offer_to_2 < prob2*budget
replace otheri=1 if mwci==0 & gci==0 & selfi==0

*Alternative definition of minimal winning coalition and grand coalition: 10% threshold
gen offer_to_self =.
gen offer_to_self2 =.
replace offer_to_self = offer_to_1 if id_in_group==1
replace offer_to_self = offer_to_2 if id_in_group==2
replace offer_to_self = offer_to_3 if id_in_group==3
replace offer_to_self2 = offer_to_1_2 if id_in_group==1
replace offer_to_self2 = offer_to_2_2 if id_in_group==2
replace offer_to_self2 = offer_to_3_2 if id_in_group==3

gen mwcj=0
gen gcj=0
gen selfj=0
gen otherj=0
gen included_1_10=0
gen included_2_10=0
gen included_3_10=0
replace included_1_10=1 if offer_to_1>=0.1*60
replace included_2_10=1 if offer_to_2>=0.1*60
replace included_3_10=1 if offer_to_3>=0.1*60
replace mwcj=1 if included_1_10+included_2_10+included_3_10==2
replace gcj=1 if included_1_10+included_2_10+included_3_10==3
replace selfj=1 if included_1_10+included_2_10+included_3_10==1 & offer_to_self>=0.1*60
replace otherj=1 if included_1_10+included_2_10+included_3_10==1 & offer_to_self<0.1*60

*generate 6 bins of 5 rounds
gen round_bin =.
replace round_bin = 1 if round <=5
replace round_bin = 2 if round >5 & round <=10
replace round_bin = 3 if round >10 & round <=15
replace round_bin = 4 if round >15 & round <=20
replace round_bin = 5 if round >20 & round <=25
replace round_bin = 6 if round >25 & round <=30
gen endogenous=.
replace endogenous = 0 if round_bin<=3
replace endogenous = 1 if round_bin>3

*Convert to percentages
gen mwc_perc = mwc*100
gen gc_perc = gc*100
gen self_perc = self*100
gen other_perc = other*100
gen mwc_perc2 = mwc2*100
gen gc_perc2 = gc2*100
gen self_perc2 = self2*100
gen other_perc2 = other2*100
gen mwci_perc = mwci*100
gen gci_perc = gci*100
gen selfi_perc = selfi*100
gen otheri_perc = otheri*100
gen mwcj_perc = mwcj*100
gen gcj_perc = gcj*100
gen selfj_perc = selfj*100
gen otherj_perc = otherj*100

*Code votes and agreement in each stage
sort treatment session round group id_in_group
gen vote1 =.
gen vote2 =.
gen vote3 =.
gen vote1_2 =.
gen vote2_2 =.
gen vote3_2 =.
gen agreement =.
gen agreement2 =.

*Code votes by member 1, 2, and 3 in a given group
replace vote1 = vote if id_in_group==1
replace vote2 = vote[_n+1] if id_in_group==1
replace vote3 = vote[_n+2] if id_in_group==1
replace vote1_2 = vote_2 if id_in_group==1
replace vote2_2 = vote_2[_n+1] if id_in_group==1
replace vote3_2 = vote_2[_n+2] if id_in_group==1

*No stage-2 vote for treatment3 
replace vote1_2 = . if treatment==3 & id_in_group==1
replace vote2_2 = . if treatment==3 & id_in_group==1
replace vote3_2 = . if treatment==3 & id_in_group==1

*Automated votes for treatment4
replace vote1 = 0 if treatment==4 & id_in_group==1
replace vote1 = 1 if treatment==4 & id_in_group==1 & chosen_offer_to_1 >= budget*prob1_2
replace vote2 = 0 if treatment==4 & id_in_group==1
replace vote2 = 1 if treatment==4 & id_in_group==1 & chosen_offer_to_2 >= budget*prob2_2
replace vote3 = 0 if treatment==4 & id_in_group==1
replace vote3 = 1 if treatment==4 & id_in_group==1 & chosen_offer_to_3 >= budget*prob3_2
replace vote1_2 = 1 if treatment==4 & id_in_group==1
replace vote2_2 = 1 if treatment==4 & id_in_group==1
replace vote3_2 = 1 if treatment==4 & id_in_group==1

*Agreement in stage 1/ Agreement in stage 2 : indicators
replace agreement = 0 if id_in_group==1
replace agreement = 1 if id_in_group==1 & vote1 + vote2 + vote3 > 1
replace agreement2 = 0 if id_in_group==1
replace agreement2 = 1 if id_in_group==1 & agreement==0 & vote1_2 + vote2_2 + vote3_2  > 1
replace agreement2 = . if treatment==3
gen final_agreement=agreement+agreement2
gen agreement_perc = agreement*100
gen final_agreement_perc = final_agreement*100


***Section 6.1

*Figure 1
sort treatment session round group id_in_group
gen final_allocation=.
replace final_allocation = playerpayoff if round<16
replace final_allocation = playerpayoff - (auc_endowment-bid_paid) if round>15

gen final_allocation_1 =.
gen final_allocation_2 =.
gen final_allocation_3 =.
replace final_allocation_1 = final_allocation if id_in_group==1
replace final_allocation_2 = final_allocation[_n+1] if id_in_group==1
replace final_allocation_3 = final_allocation[_n+2] if id_in_group==1

egen mean_final_allocation_1 = mean(final_allocation_1), by(treatment)
egen mean_final_allocation_2 = mean(final_allocation_2), by(treatment)
egen mean_final_allocation_3 = mean(final_allocation_3), by(treatment)
egen mean_final_allocation_1_11 = mean(final_allocation_1) if round>=11 & round<=15, by(treatment)
egen mean_final_allocation_2_11 = mean(final_allocation_2) if round>=11 & round<=15, by(treatment)
egen mean_final_allocation_3_11 = mean(final_allocation_3) if round>=11 & round<=15, by(treatment)
egen mean_final_allocation_1_26 = mean(final_allocation_1) if round>=26 & round<=30, by(treatment)
egen mean_final_allocation_2_26 = mean(final_allocation_2) if round>=26 & round<=30, by(treatment)
egen mean_final_allocation_3_26 = mean(final_allocation_3) if round>=26 & round<=30, by(treatment)

gen id_in_group_11 = id_in_group+3 
gen id_in_group_26 = id_in_group+6

bysort id_in_group treatment : ci final_allocation
gen ci_l =.
gen ci_h =.
replace ci_l = 20.77362 if treatment==1 & id_in_group==1
replace ci_l = 20.94148 if treatment==2 & id_in_group==1
replace ci_l = 18.75174 if treatment==3 & id_in_group==1
replace ci_l = 21.9259  if treatment==4 & id_in_group==1
replace ci_h = 22.80972 if treatment==1 & id_in_group==1
replace ci_h = 23.01038 if treatment==2 & id_in_group==1
replace ci_h = 21.64409 if treatment==3 & id_in_group==1
replace ci_h = 24.91577 if treatment==4 & id_in_group==1

replace ci_l = 19.65408 if treatment==1 & id_in_group==2
replace ci_l = 18.73153 if treatment==2 & id_in_group==2
replace ci_l = 21.0354  if treatment==3 & id_in_group==2
replace ci_l = 18.87088 if treatment==4 & id_in_group==2
replace ci_h = 21.65009 if treatment==1 & id_in_group==2
replace ci_h = 20.54254 if treatment==2 & id_in_group==2
replace ci_h = 23.63127 if treatment==3 & id_in_group==2
replace ci_h = 21.54995 if treatment==4 & id_in_group==2

replace ci_l = 16.24206 if treatment==1 & id_in_group==3
replace ci_l = 16.49022 if treatment==2 & id_in_group==3
replace ci_l = 16.12936 if treatment==3 & id_in_group==3
replace ci_l = 14.91444 if treatment==4 & id_in_group==3
replace ci_h = 18.37044 if treatment==1 & id_in_group==3
replace ci_h = 18.28386 if treatment==2 & id_in_group==3
replace ci_h = 18.80814 if treatment==3 & id_in_group==3
replace ci_h = 17.82306 if treatment==4 & id_in_group==3

bysort id_in_group treatment : ci final_allocation if round>=11 & round<=15
gen ci_l_11 =.
gen ci_h_11 =.
replace ci_l_11 = 19.66586 if treatment==1 & id_in_group==1
replace ci_l_11 = 19.21043  if treatment==2 & id_in_group==1
replace ci_l_11 = 14.4868 if treatment==3 & id_in_group==1
replace ci_l_11 = 20.7599   if treatment==4 & id_in_group==1
replace ci_h_11 = 24.58414 if treatment==1 & id_in_group==1
replace ci_h_11 = 23.87846 if treatment==2 & id_in_group==1
replace ci_h_11 = 21.7382 if treatment==3 & id_in_group==1
replace ci_h_11 = 28.3151 if treatment==4 & id_in_group==1

replace ci_l_11 = 15.54689  if treatment==1 & id_in_group==2
replace ci_l_11 = 19.39595 if treatment==2 & id_in_group==2
replace ci_l_11 = 21.36181 if treatment==3 & id_in_group==2
replace ci_l_11 = 16.4347   if treatment==4 & id_in_group==2
replace ci_h_11 = 21.10311 if treatment==1 & id_in_group==2
replace ci_h_11 = 23.7596 if treatment==2 & id_in_group==2
replace ci_h_11 = 28.68819 if treatment==3 & id_in_group==2
replace ci_h_11 = 22.8903 if treatment==4 & id_in_group==2

replace ci_l_11 = 16.13672  if treatment==1 & id_in_group==3
replace ci_l_11 = 13.79077  if treatment==2 & id_in_group==3
replace ci_l_11 = 13.76598  if treatment==3 & id_in_group==3
replace ci_l_11 = 12.02913  if treatment==4 & id_in_group==3
replace ci_h_11 = 21.46328 if treatment==1 & id_in_group==3
replace ci_h_11 = 18.63145 if treatment==2 & id_in_group==3
replace ci_h_11 = 19.95902 if treatment==3 & id_in_group==3
replace ci_h_11 = 19.57087 if treatment==4 & id_in_group==3

bysort id_in_group treatment : ci final_allocation if round>=26 & round<=30
gen ci_l_26 =.
gen ci_h_26 =.
replace ci_l_26 =  18.77848 if treatment==1 & id_in_group==1
replace ci_l_26 =  18.64455 if treatment==2 & id_in_group==1
replace ci_l_26 = 17.28028  if treatment==3 & id_in_group==1
replace ci_l_26 = 19.61853  if treatment==4 & id_in_group==1
replace ci_h_26 = 24.59652 if treatment==1 & id_in_group==1
replace ci_h_26 = 24.46656 if treatment==2 & id_in_group==1
replace ci_h_26 = 24.64472 if treatment==3 & id_in_group==1
replace ci_h_26 = 28.58147 if treatment==4 & id_in_group==1

replace ci_l_26 =  16.57066  if treatment==1 & id_in_group==2
replace ci_l_26 =  16.3779  if treatment==2 & id_in_group==2
replace ci_l_26 =  19.36409   if treatment==3 & id_in_group==2
replace ci_l_26 = 12.4307  if treatment==4 & id_in_group==2
replace ci_h_26 = 22.10434 if treatment==1 & id_in_group==2
replace ci_h_26 = 21.44432 if treatment==2 & id_in_group==2
replace ci_h_26 =  25.58591 if treatment==3 & id_in_group==2
replace ci_h_26 = 20.1443 if treatment==4 & id_in_group==2

replace ci_l_26 = 15.48433  if treatment==1 & id_in_group==3
replace ci_l_26 = 15.18667  if treatment==2 & id_in_group==3
replace ci_l_26 = 13.02557  if treatment==3 & id_in_group==3
replace ci_l_26 = 15.45407  if treatment==4 & id_in_group==3
replace ci_h_26 = 20.96567 if treatment==1 & id_in_group==3
replace ci_h_26 = 19.87999 if treatment==2 & id_in_group==3
replace ci_h_26 = 20.09943 if treatment==3 & id_in_group==3
replace ci_h_26 = 23.77093 if treatment==4 & id_in_group==3

twoway (scatter mean_final_allocation_1 id_in_group if round==1 & id_in_group==1, sort mcolor(black) msymbol(circle) msize(small)) (scatter mean_final_allocation_2 id_in_group if round==1 & id_in_group==2, sort mcolor(black) msymbol(X) msize(medium)) (scatter mean_final_allocation_3 id_in_group if round==1 & id_in_group==3, sort mcolor(black) msymbol(triangle) msize(small)) (scatter mean_final_allocation_1_11 id_in_group_11 if round==11 & id_in_group_11==4, sort mcolor(gs10) msymbol(circle) msize(small)) (scatter mean_final_allocation_2_11 id_in_group_11 if round==11 & id_in_group_11==5, sort mcolor(gs10) msymbol(X) msize(medium)) (scatter mean_final_allocation_3_11 id_in_group_11 if round==11 & id_in_group_11==6, sort mcolor(gs10) msymbol(triangle) msize(small)) (scatter mean_final_allocation_1_26 id_in_group_26 if round==26 & id_in_group_26==7, sort)(scatter mean_final_allocation_2_26 id_in_group_26 if round==26 & id_in_group_26==8, sort mcolor(black) msymbol(X) msize(medium)) (scatter mean_final_allocation_3_26 id_in_group_26 if round==26 & id_in_group_26==9, sort mcolor(black) msymbol(triangle_hollow) msize(medium))(rcap ci_l ci_h id_in_group if round==1, sort lwidth(thin) lcolor(black))(rcap ci_l_11 ci_h_11 id_in_group_11 if round==11, sort lwidth(thin) lcolor(black)) (rcap ci_l_26 ci_h_26 id_in_group_26 if round==26, sort lwidth(thin) lcolor(black)), by(treatment, note("")) legend(row(1) order(10 "95% confidence interval")) xlabel(1 "High" 2 "Mid" 3 "Low" 4 "High" 5 "Mid" 6 "Low" 7 "High" 8 "Mid" 9 "Low") ylabel(10(5)30) xtitle(Recognition probability in period 2) ytitle(Allocation(€)) scheme(s1mono)
*The texts "All rounds", "Round 11-15", "Round 26-30" were added manually on Stata graph editor

*t-tests
by treatment, sort : ttest final_allocation_1 == final_allocation_2 if id_in_group==1
by treatment, sort : ttest final_allocation_1 == final_allocation_2 if id_in_group==1 & round>=11 & round<=15
by treatment, sort : ttest final_allocation_1 == final_allocation_2 if id_in_group==1 & round>=26 & round<=30

*mean allocation conditional on rejection
by treatment: sum final_allocation_1 final_allocation_2 final_allocation_3 if agreement==0 & id_in_group==1

*t-test
by treatment, sort : ttest final_allocation_1 == final_allocation_2 if id_in_group==1 & agreement==1

***Section 6.2

*Figure 2
gen bid_role_1 =0
gen bid_role_2 =0
gen bid_role_3 =0
replace bid_role_1 = 1 if bid_role==1
replace bid_role_2 = 1 if bid_role==2
replace bid_role_3 = 1 if bid_role==3
gen bid_role_1_perc =bid_role_1*100
gen bid_role_2_perc =bid_role_2*100
gen bid_role_3_perc =bid_role_3*100

drop mean_final_allocation_1 mean_final_allocation_2 mean_final_allocation_3
egen mean_final_allocation_1 = mean(final_allocation_1), by(treatment round_bin)
egen mean_final_allocation_2 = mean(final_allocation_2), by(treatment round_bin)
egen mean_final_allocation_3 = mean(final_allocation_3), by(treatment round_bin)

gen bid_role_4=0
replace bid_role_4=1 if bid==0
replace bid_role_1=0 if bid==0
replace bid_role_2=0 if bid==0
replace bid_role_3=0 if bid==0

by treatment, sort : egen float count = count(round>15)
gen count1=count/2
gen count26=count/6
gen bid_role_4_disp = bid_role_4 / count1*100
gen bid_role_1_disp = bid_role_1 / count1*100	
gen bid_role_2_disp = bid_role_2 / count1*100
gen bid_role_3_disp = bid_role_3 / count1*100
gen bid_role_4_disp26 = bid_role_4 / count26*100
gen bid_role_1_disp26 = bid_role_1 / count26*100	
gen bid_role_2_disp26 = bid_role_2 / count26*100
gen bid_role_3_disp26 = bid_role_3 / count26*100

graph bar (sum) bid_role_4_disp26 bid_role_1_disp26 bid_role_2_disp26 bid_role_3_disp26 if round>25, over(bid) by(treatment, note("") col(2)) nofill bar(1, fcolor(gs12) lcolor(black) lwidth(vthin)) bar(2, fcolor(gs2) lcolor(gs2) lwidth(vthin)) bar(3, fcolor(none) lcolor(black) lwidth(vthin)) bar(4, fcolor(gs6) lcolor(gs6) lwidth(vthin)) ytitle(Frequency(%)) legend(row(1) size(vsmall) order(2 "High recognition probability" 3 "Middle recognition probability" 4 "Low recognition probability")) scheme(s1mono) stack
*The x-axis label "Chosen amount to pay (€)" was added manually on Stata graph editor

*texts on Figure 2
by treatment: tab bid_role if bid > 0 & round>=26 & round<=30

*probit tests
probit bid_role_1 treatment if treatment!=2 & treatment!=4 & round>=26 & bid>0, vce(cluster subject_id)
probit bid_role_2 treatment if treatment!=2 & treatment!=4 & round>=26 & bid>0, vce(cluster subject_id)

***Section 6.3

*Figure 3
insobs 4
replace treatment = 1 in 5941
replace treatment = 2 in 5942
replace treatment = 3 in 5943
replace treatment = 4 in 5944
replace round_bin=7 in 5941
replace round_bin=7 in 5942
replace round_bin=7 in 5943
replace round_bin=7 in 5944
bysort treatment: egen gc_perc1=mean(gc_perc)
replace gc_perc=gc_perc1 if round_bin==7
bysort treatment: egen mwc_perc1=mean(mwc_perc)
replace mwc_perc=mwc_perc1 if round_bin==7
bysort treatment: egen self_perc1=mean(self_perc)
replace self_perc=self_perc1 if round_bin==7

sort round_bin treatment 

graph bar (mean) gc_perc mwc_perc self_perc, by(treatment, note("")) over(round_bin, relabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30" 7"All")) b1title(Round) ytitle(Frequency(%), margin(small)) xsize(8) ysize(6) legend(row(1) order(1 "Grand coalition" 2 "Minimal winning coalition" 3 "All to self")) bar(1, fcolor(gs2)) bar(2, fcolor(gs6)) bar(3, fcolor(gs12)) blabel(bar, color (white) position(center) format(%2.0f)) scheme(s1mono) stack
*The colors of some value labels were manually changed from white to black on Stata graph editor for visibility 

drop in 5941/5944

*probit regression
by treatment, sort: probit mwc round, vce(cluster subject_id)

*Figure 4
gen mwc_or_gc = 0
replace mwc_or_gc = 1 if mwc==1 | gc==1
gen mwc_or_gc_2 = .
replace mwc_or_gc_2 = 0 if offer_to_1_2 !=. | offer_to_2_2 !=. | offer_to_3_2 !=.
replace mwc_or_gc_2 = 1 if mwc2==1
replace mwc_or_gc_2 = 1 if gc2==1

gen cmc=0
gen cmc2=.
replace cmc=1 if mwc_or_gc == 1 & id_in_group==1 & offer_to_2 < offer_to_3
replace cmc=1 if mwc_or_gc == 1 & id_in_group==2 & offer_to_1 < offer_to_3
replace cmc=1 if mwc_or_gc == 1 & id_in_group==3 & offer_to_1 < offer_to_2
replace cmc2=0 if mwc_or_gc_2 == 1
replace cmc2=1 if mwc_or_gc_2 == 1 & id_in_group==1 & offer_to_2_2 < offer_to_3_2
replace cmc2=1 if mwc_or_gc_2 == 1 & id_in_group==2 & offer_to_1_2 < offer_to_3_2
replace cmc2=1 if mwc_or_gc_2 == 1 & id_in_group==3 & offer_to_1_2 < offer_to_2_2
gen cmc_perc = cmc*100
gen cmc_perc2 = cmc2*100

gen cmci=0
replace cmci=1 if mwci== 1 & id_in_group==1 & offer_to_2 < prob2*budget & offer_to_3 >= prob3*budget
replace cmci=1 if mwci== 1 & id_in_group==2 & offer_to_1 < prob1*budget & offer_to_3 >= prob3*budget
replace cmci=1 if mwci== 1 & id_in_group==3 & offer_to_1 < prob1*budget & offer_to_2 >= prob2*budget
gen cmci_perc = cmci*100
gen cmcj=0
replace cmcj=1 if mwcj== 1 & id_in_group==1 & offer_to_2 < 0.1*budget & offer_to_3 >= 0.1*budget
replace cmcj=1 if mwcj== 1 & id_in_group==2 & offer_to_1 < 0.1*budget & offer_to_3 >= 0.1*budget
replace cmcj=1 if mwcj== 1 & id_in_group==3 & offer_to_1 < 0.1*budget & offer_to_2 >= 0.1*budget
gen cmcj_perc = cmcj*100

by treatment: tab cmc_perc if mwc==1

egen mean_cmc_perc_mwc = mean(cmc_perc) if mwc==1, by(treatment round_bin)
egen mean_cmci_perc_mwci = mean(cmci_perc) if mwci==1, by(treatment round_bin)
egen mean_cmcj_perc_mwcj = mean(cmcj_perc) if mwcj==1, by(treatment round_bin)
gen mean_cmc_perc_mwc_label = string(mean_cmc_perc_mwc, "%2.0f")
gen mean_cmci_perc_mwci_label = string(mean_cmci_perc_mwci, "%2.0f")
gen mean_cmcj_perc_mwcj_label = string(mean_cmcj_perc_mwcj, "%2.0f")

twoway (connected mean_cmc_perc_mwc round_bin, sort mlabel(mean_cmc_perc_mwc_label) mlabposition(12)), by(treatment, note("")) xlabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30") xtitle(Round) ytitle(Frequency(%)) ylabel(0(10)70) scheme(s1mono)

*probit regression
bysort treatment: probit cmc round if mwc==1, vce(cluster subject_id)

*Table 4
gen chosen_offer_to_self=.
gen chosen_offer_to_self2=.
replace chosen_offer_to_self = chosen_offer_to_1 if id_in_group==1
replace chosen_offer_to_self = chosen_offer_to_2 if id_in_group==2
replace chosen_offer_to_self = chosen_offer_to_3 if id_in_group==3 
replace chosen_offer_to_self2 = chosen_offer_to_1_2 if id_in_group==1
replace chosen_offer_to_self2 = chosen_offer_to_2_2 if id_in_group==2
replace chosen_offer_to_self2 = chosen_offer_to_3_2 if id_in_group==3

gen chosen_offer_to_proposer=.
gen chosen_offer_to_proposer2=.
replace chosen_offer_to_proposer = chosen_offer_to_1 if proposer==1
replace chosen_offer_to_proposer = chosen_offer_to_2 if proposer==2
replace chosen_offer_to_proposer = chosen_offer_to_3 if proposer==3
replace chosen_offer_to_proposer2 = chosen_offer_to_1_2 if proposer_2==1
replace chosen_offer_to_proposer2 = chosen_offer_to_2_2 if proposer_2==2
replace chosen_offer_to_proposer2 = chosen_offer_to_3_2 if proposer_2==3

gen included_unc=0
replace included_unc=1 if chosen_offer_to_self!=0
bysort treatment id_in_group: sum included_unc
bysort treatment id_in_group: sum included_unc if round>=11 & round<=15
bysort treatment id_in_group: sum included_unc if round>=26 & round<=30

*footnote 16: Signrank test
gen included_1=.
gen included_2=.
gen included_3=.
replace included_1=0 if id_in_group==1
replace included_2=0 if id_in_group==1
replace included_3=0 if id_in_group==1
replace included_1=1 if id_in_group==1 & chosen_offer_to_1>0
replace included_2=1 if id_in_group==1 & chosen_offer_to_2>0
replace included_3=1 if id_in_group==1 & chosen_offer_to_3>0
by treatment, sort : signrank included_1=included_2 if id_in_group==1

*Table 5
bysort treatment id_in_group: sum cmc if mwc==1
bysort treatment id_in_group: sum cmc if mwc==1 & round>=11 & round<=15
bysort treatment id_in_group: sum cmc if mwc==1 & round>=26 & round<=30

***Section 7 

*footnote 19 : probit regression
gen one_wins = .
replace one_wins = 0 if final_allocation_1 == final_allocation_2
replace one_wins = 1 if final_allocation_1 > final_allocation_2
replace one_wins = -1 if final_allocation_1 < final_allocation_2

ssc install rangestat
rangestat (mean) one_wins, interval(round . -1) by(treatment subject_id)

gen bid_for_1 = . 
gen bid_for_2 = . 
replace bid_for_1 = 0 if round>15
replace bid_for_2 = 0 if round>15
replace bid_for_1 = 1 if round>15 & bid>0 & bid_role ==1
replace bid_for_2 = 1 if round>15 & bid>0 & bid_role ==2

probit bid_for_1 one_wins_mean, vce(cluster subject_id)
probit bid_for_2 one_wins_mean, vce(cluster subject_id)

***********************
*Analyses - appendices*
***********************

***Appendix A

*Figure 5 : See Matlab code

*Figure 6
graph bar (sum) bid_role_4_disp bid_role_1_disp bid_role_2_disp bid_role_3_disp if round>15, over(bid) by(treatment, note("") col(2)) nofill bar(1, fcolor(gs12) lcolor(black) lwidth(vthin)) bar(2, fcolor(gs2) lcolor(gs2) lwidth(vthin)) bar(3, fcolor(none) lcolor(black) lwidth(vthin)) bar(4, fcolor(gs6) lcolor(gs6) lwidth(vthin)) ytitle(Frequency(%)) legend(row(1) size(vsmall) order(2 "High recognition probability" 3 "Middle recognition probability" 4 "Low recognition probability")) scheme(s1mono) stack
*The x-axis label "Chosen amount to pay (€)" was added manually on Stata graph editor

***Appendix B

*Figure 7
insobs 4
replace treatment = 1 in 5941
replace treatment = 2 in 5942
replace treatment = 3 in 5943
replace treatment = 4 in 5944
replace round_bin=7 in 5941
replace round_bin=7 in 5942
replace round_bin=7 in 5943
replace round_bin=7 in 5944

bysort treatment: egen gcj_perc1=mean(gcj_perc)
replace gcj_perc=gcj_perc1 if round_bin==7
bysort treatment: egen mwcj_perc1=mean(mwcj_perc)
replace mwcj_perc=mwcj_perc1 if round_bin==7
bysort treatment: egen selfj_perc1=mean(selfj_perc)
replace selfj_perc=selfj_perc1 if round_bin==7

sort round_bin treatment 

graph bar (mean) gcj_perc mwcj_perc selfj_perc, by(treatment, note("")) over(round_bin, relabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30" 7"All")) b1title(Round) ytitle(Frequency(%), margin(small)) xsize(8) ysize(6) legend(row(1) order(1 "Grand coalition" 2 "Minimal winning coalition" 3 "All to self")) bar(1, fcolor(gs2)) bar(2, fcolor(gs6)) bar(3, fcolor(gs12)) blabel(bar, color (white) position(center) format(%2.0f)) scheme(s1mono) stack
*The colors of some value labels were manually changed from white to black on Stata graph editor for visibility 

drop in 5941/5944

*Figure 8
twoway (connected mean_cmcj_perc_mwcj round_bin, sort mlabel(mean_cmcj_perc_mwcj_label) mlabposition(12)), by(treatment, note("")) xlabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30") xtitle(Round) ytitle(Frequency(%)) ylabel(0(10)70) scheme(s1mono)

*Figure 9
insobs 4
replace treatment = 1 in 5941
replace treatment = 2 in 5942
replace treatment = 3 in 5943
replace treatment = 4 in 5944
replace round_bin=7 in 5941
replace round_bin=7 in 5942
replace round_bin=7 in 5943
replace round_bin=7 in 5944

bysort treatment: egen gci_perc1=mean(gci_perc)
replace gci_perc=gci_perc1 if round_bin==7
bysort treatment: egen mwci_perc1=mean(mwci_perc)
replace mwci_perc=mwci_perc1 if round_bin==7
bysort treatment: egen selfi_perc1=mean(selfi_perc)
replace selfi_perc=selfi_perc1 if round_bin==7

sort round_bin treatment 

graph bar (mean) gci_perc mwci_perc selfi_perc, by(treatment, note("")) over(round_bin, relabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30" 7"All")) b1title(Round) ytitle(Frequency(%), margin(small)) xsize(8) ysize(6) legend(row(1) order(1 "Grand coalition" 2 "Minimal winning coalition" 3 "All to self")) bar(1, fcolor(gs2)) bar(2, fcolor(gs6)) bar(3, fcolor(gs12)) blabel(bar, color (white) position(center) format(%2.0f)) scheme(s1mono) stack

drop in 5941/5944

*Figure 10
twoway (connected mean_cmci_perc_mwci round_bin, sort mlabel(mean_cmci_perc_mwci_label) mlabposition(12)), by(treatment, note("")) xlabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30") xtitle(Round) ytitle(Frequency(%)) ylabel(0(10)70) scheme(s1mono)

*Figure 11
by treatment subject_id, sort : egen float cmc_mean1 = mean(cmc) if mwc==1 & id_in_group==1
by treatment subject_id, sort : egen float cmc_mean2 = mean(cmc) if mwc==1 & id_in_group==2
by treatment subject_id, sort : egen float cmc_mean3 = mean(cmc) if mwc==1 & id_in_group==3
by treatment subject_id, sort : egen float cmc_mean = mean(cmc) if mwc==1
by treatment subject_id, sort : egen float mwc_count = sum(mwc)
by treatment subject_id, sort : egen float mwc_count1 = sum(mwc) if id_in_group==1  
by treatment subject_id, sort : egen float mwc_count2 = sum(mwc) if id_in_group==2  
by treatment subject_id, sort : egen float mwc_count3 = sum(mwc) if id_in_group==3 

by treatment subject_id, sort : egen float cmc_mean1_ = max(cmc_mean1)
by treatment subject_id, sort : egen float cmc_mean2_ = max(cmc_mean2)
by treatment subject_id, sort : egen float cmc_mean3_ = max(cmc_mean3) 
by treatment subject_id, sort : egen float cmc_mean_ = max(cmc_mean) 
by treatment subject_id, sort : egen float mwc_count1_ = max(mwc_count1)
by treatment subject_id, sort : egen float mwc_count2_ = max(mwc_count2)
by treatment subject_id, sort : egen float mwc_count3_ = max(mwc_count3) 

egen freq_cmc = total(1), by(treatment mwc_count cmc_mean_)

twoway (scatter cmc_mean_ mwc_count [fweight=freq_cmc] if round==1, mcolor(black) mlwidth(vthin) msymbol(Oh) msize(small) sort) (lfit cmc_mean_ mwc_count if round==1), by(treatment) xlabel (0(5)30) ylabel(0(0.2)1) xtitle(Number of minimum winning coalition offers) ytitle(Frequency of partner choice consistent with BF (%)) scheme(s1mono) legend(off)

*Pearson correlation test
pwcorr cmc_mean_ mwc_count if round==1, sig

*Table 6
gen mwc_player = 0
replace mwc_player = 1 if mwc_count>=10 & mwc_count1_>=2 & mwc_count2_>=2 & mwc_count3_>=2
gen mwc_incons = 0
replace mwc_incons = 1 if mwc_player==1 & cmc_mean1_==0 & cmc_mean2_==0 & cmc_mean3_==0
gen mwc_cons = 0
replace mwc_cons = 1 if mwc_player==1 & cmc_mean1_==1 & cmc_mean2_==1 & cmc_mean3_==1
gen mwc_incons_imp = 0
replace mwc_incons_imp = 1 if mwc_player==1 & cmc_mean1_<=0.33333334 & cmc_mean2_<=0.33333334 & cmc_mean3_<=0.33333334 & mwc_incons!=1
gen mwc_cons_imp = 0
replace mwc_cons_imp = 1 if mwc_player==1 & cmc_mean1_>=0.6666666 & cmc_mean2_>=0.6666666 & cmc_mean3_>=0.6666666 & mwc_cons!=1
gen mwc_intm_imp = 0
replace mwc_intm_imp = 1 if mwc_player==1 & cmc_mean1_>=0.333333333 & cmc_mean1_<=0.66666667 & cmc_mean2_>=0.333333333 & cmc_mean2_<=0.66666667 & cmc_mean3_>=0.333333333 & cmc_mean3_<=0.66666667

by treatment: count if round==1 & mwc_player == 0
by treatment: count if round==1 & mwc_count>=10 & mwc_count1_>=2 & mwc_count2_>=2 & mwc_count3_>=2
by treatment: count if round==1 & mwc_count>=10 & mwc_count1_>=2 & mwc_count2_>=2 & mwc_count3_>=2 & cmc_mean1_==0 & cmc_mean2_==0 & cmc_mean3_==0
by treatment: count if round==1 & mwc_player==1 & cmc_mean1_<=0.33333334 & cmc_mean2_<=0.33333334 & cmc_mean3_<=0.33333334 & mwc_incons!=1
by treatment: count if round==1 & mwc_player==1 & cmc_mean1_>=0.333333333 & cmc_mean1_<=0.66666667 & cmc_mean2_>=0.333333333 & cmc_mean2_<=0.66666667 & cmc_mean3_>=0.333333333 & cmc_mean3_<=0.66666667 
by treatment: count if round==1 & mwc_player==1 & cmc_mean1_>=0.6666666 & cmc_mean2_>=0.6666666 & cmc_mean3_>=0.6666666 & mwc_cons!=1
by treatment: count if round==1 & mwc_count>=10 & mwc_count1_>=2 & mwc_count2_>=2 & mwc_count3_>=2 & cmc_mean1_==1 & cmc_mean2_==1 & cmc_mean3_==1
by treatment: count if round==1 & mwc_player==1 & mwc_cons!=1 & mwc_incons!=1 & mwc_intm_imp !=1 & mwc_cons_imp!=1  & mwc_incons_imp!=1 & cmc_mean1_<=cmc_mean2_ & cmc_mean2_<=cmc_mean3_ & cmc_mean1_ != cmc_mean3_
by treatment: count if round==1 & mwc_player==1 & mwc_cons!=1 & mwc_incons!=1 & mwc_intm_imp !=1 & mwc_cons_imp!=1  & mwc_incons_imp!=1 & cmc_mean1_< cmc_mean3_ 
by treatment: count if round==1 & mwc_player==1 & mwc_cons!=1 & mwc_incons!=1  & mwc_cons_imp!=1 & mwc_intm_imp !=1 & mwc_incons_imp!=1 & cmc_mean1_>=cmc_mean2_ & cmc_mean2_>=cmc_mean3_ & cmc_mean1_ != cmc_mean3_
by treatment: count if round==1 & mwc_player==1 & mwc_cons!=1 & mwc_incons!=1 & mwc_intm_imp !=1 & mwc_cons_imp!=1  & mwc_incons_imp!=1 & cmc_mean1_> cmc_mean3_ 

***Appendix D.1

*Figure 12
gen offer_to_h =.
gen offer_to_l =.
gen offer_to_h2 =.
gen offer_to_l2 =.
replace offer_to_h = offer_to_2 if id_in_group==1
replace offer_to_l = offer_to_3 if id_in_group==1
replace offer_to_h = offer_to_1 if id_in_group==2
replace offer_to_l = offer_to_3 if id_in_group==2
replace offer_to_h = offer_to_1 if id_in_group==3
replace offer_to_l = offer_to_2 if id_in_group==3
replace offer_to_h2 = offer_to_2_2 if id_in_group==1
replace offer_to_l2 = offer_to_3_2 if id_in_group==1
replace offer_to_h2 = offer_to_1_2 if id_in_group==2
replace offer_to_l2 = offer_to_3_2 if id_in_group==2
replace offer_to_h2 = offer_to_1_2 if id_in_group==3
replace offer_to_l2 = offer_to_2_2 if id_in_group==3

egen freq = total(1), by(treatment offer_to_h offer_to_l)
egen freq2 = total(1), by(treatment offer_to_h2 offer_to_l2)
gen oh = 0
gen ol = 60
gen o = 0
replace oh = 60 if round>15
replace ol = 0 if round>15

twoway (scatter offer_to_l offer_to_h [fweight = freq], mcolor(black) mlwidth(vthin) msymbol(Oh) msize(vsmall) legend(off) by(treatment, note("")) ysize(3) xsize(3) ylabel(0(10)60) xlabel(0(10)60) ytitle(Offer to non-proposer with smaller recognition prob(€), size(small)) xtitle(Offer to the non-proposer with greater recognition prob(€), size(small)) xline(0, lwidth(thin) lcolor(gray)) yline(0, lwidth(thin) lcolor(gray)) ) (lfit oh ol, lwidth(thin) lcolor(gray) ), scheme(s1mono) legend(off)

*Figure 13
by treatment: sum offer_to_self if mwc==1 | gc==1
by treatment: sum offer_to_self if mwc==1
by treatment: sum offer_to_self if gc==1
by treatment: sum offer_to_self2 if mwc2==1 | gc2==1
by treatment: sum offer_to_self2 if mwc2==1
by treatment: sum offer_to_self2 if gc2==1

gen offer_to_other=60-offer_to_self 
gen offer_to_other2=60-offer_to_self2

gen offer_category =.
replace offer_category =1 if offer_to_other>=0 & offer_to_other<=18
replace offer_category =2 if offer_to_other==19
replace offer_category =3 if offer_to_other==20
replace offer_category =4 if offer_to_other==21
replace offer_category =5 if offer_to_other>=22 & offer_to_other<=24
replace offer_category =6 if offer_to_other==25
replace offer_category =7 if offer_to_other>=26 & offer_to_other<=29
replace offer_category =8 if offer_to_other==30
replace offer_category =9 if offer_to_other>=31 & offer_to_other<=60
label define offer_category_label 1 "0-18" 2 "19" 3 "20" 4 "21" 5 "22-24" 6 "25" 7 "26-29" 8 "30" 9 "31-60" 
label values offer_category offer_category_label

graph bar if mwc==1, over(offer_category) ytitle(Frequency(%)) scheme(s1mono) by(treatment, note(""))
*The "Continuation Value" lines were added manually on Stata graph editor
*Continuation value = €60*(recognition probability in the 2nd period)

***Appendix D.2

*Share of votes consistent with the BF prediction
gen above_cv=0
gen below_cv=0
replace above_cv=1 if chosen_offer_to_self>prob1_2*budget & id_in_group==1
replace above_cv=1 if chosen_offer_to_self>prob2_2*budget & id_in_group==2
replace above_cv=1 if chosen_offer_to_self>prob3_2*budget & id_in_group==3
replace below_cv=1 if chosen_offer_to_self<prob1_2*budget & id_in_group==1
replace below_cv=1 if chosen_offer_to_self<prob2_2*budget & id_in_group==2
replace below_cv=1 if chosen_offer_to_self<prob3_2*budget & id_in_group==3

by treatment, sort: sum vote if above_cv==1

***Figure 14
egen chosen_offer_to_self_cat = cut(chosen_offer_to_self), at(0,5,10,15,20,25,30,35,40,45,50,55,60,65)
egen chosen_offer_to_self_cat2 = cut(chosen_offer_to_self2), at(0,5,10,15,20,25,30,35,40,45,50,55,60,65)
gen self_to_proposer =  chosen_offer_to_self / chosen_offer_to_proposer
gen self_to_proposer2 =  chosen_offer_to_self2 / chosen_offer_to_proposer2
egen self_to_proposer_cat = cut(self_to_proposer), at(0,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1, 1.05)
egen self_to_proposer_cat2 = cut(self_to_proposer2), at(0,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1, 1.05)

label define chosen_offer_to_self_cat_label 0 "[0,5)" 5 "[5,10)" 10 "[10,15)" 15 "[15,20)" 20 "[20,25)" 25 "[25,30)" 30 "[30,35)" 35 "[35,40)" 40 "[40,45)" 45 "[45,50)" 50 "[50,55)" 55 "[55,60)" 60 "60"
label values chosen_offer_to_self_cat chosen_offer_to_self_cat_label
label values chosen_offer_to_self_cat2 chosen_offer_to_self_cat_label
label define prob_period2_label 1 "36%" 2 "33%" 3 "31%" 
label values id_in_group prob_period2_label

graph bar (sum) vote vote_no if treatment==1 & proposer != id_in_group, by(id_in_group, note("") col(1)) over(chosen_offer_to_self) bar(1, fcolor(gs2) lcolor(black) lwidth(thin)) bar(2, fcolor(white) lcolor(black) lwidth(thin)) ytitle(Number of votes) ylabel(0(30)150) legend(row(1) order(1 "Yes" 2 "No") ring(0) bplacement(neast) size(small)) xsize(10) ysize(15) scheme(s1mono) stack
*The x-axis label "Offer(€)" was added manually on Stata graph editor

*Figure 15
graph bar (sum) vote vote_no if treatment==2 & proposer != id_in_group, by(id_in_group, note("") col(1)) over(chosen_offer_to_self) bar(1, fcolor(gs2) lcolor(black) lwidth(thin)) bar(2, fcolor(white) lcolor(black) lwidth(thin)) ytitle(Number of votes) ylabel(0(30)120) legend(row(1) order(1 "Yes" 2 "No") ring(0) bplacement(neast) size(small)) xsize(10) ysize(15) scheme(s1mono) stack
*The x-axis label "Offer(€)" was added manually on Stata graph editor

*Figure 16
graph bar (sum) vote vote_no if treatment==3 & proposer != id_in_group, by(id_in_group, note("") col(1)) over(chosen_offer_to_self) bar(1, fcolor(gs2) lcolor(black) lwidth(thin)) bar(2, fcolor(white) lcolor(black) lwidth(thin)) ytitle(Number of votes) ylabel(0(30)120) legend(row(1) order(1 "Yes" 2 "No") ring(0) bplacement(neast) size(small)) xsize(10) ysize(15) scheme(s1mono) stack
*The x-axis label "Offer(€)" was added manually on Stata graph editor

***Appendix D.3

***Figure 17
gen proposer_acc  = . 
replace proposer_acc = final_allocation_1 if proposer==1 & agreement==1
replace proposer_acc = final_allocation_2 if proposer==2 & agreement==1
replace proposer_acc = final_allocation_3 if proposer==3 & agreement==1
replace proposer_acc = final_allocation_1 if proposer_2==1 & agreement==0 & agreement2==1
replace proposer_acc = final_allocation_2 if proposer_2==2 & agreement==0 & agreement2==1
replace proposer_acc = final_allocation_3 if proposer_2==3 & agreement==0 & agreement2==1
replace proposer_acc = final_allocation_1 if proposer_2==1 & agreement==0 & treatment==3
replace proposer_acc = final_allocation_2 if proposer_2==2 & agreement==0 & treatment==3
replace proposer_acc = final_allocation_3 if proposer_2==3 & agreement==0 & treatment==3

gen nonproposer_acc_h  = . 
gen nonproposer_acc_l  = . 
replace nonproposer_acc_h = max(final_allocation_2,final_allocation_3) if proposer==1 & agreement==1
replace nonproposer_acc_l = min(final_allocation_2,final_allocation_3) if proposer==1 & agreement==1
replace nonproposer_acc_h = max(final_allocation_2,final_allocation_3) if proposer_2==1 & agreement==0 & agreement2==1
replace nonproposer_acc_l = min(final_allocation_2,final_allocation_3) if proposer_2==1 & agreement==0 & agreement2==1

replace nonproposer_acc_h = max(final_allocation_1,final_allocation_3) if proposer==2 & agreement==1
replace nonproposer_acc_l = min(final_allocation_1,final_allocation_3) if proposer==2 & agreement==1
replace nonproposer_acc_h = max(final_allocation_1,final_allocation_3) if proposer_2==2 & agreement==0 & agreement2==1
replace nonproposer_acc_l = min(final_allocation_1,final_allocation_3) if proposer_2==2 & agreement==0 & agreement2==1

replace nonproposer_acc_h = max(final_allocation_1,final_allocation_2) if proposer==3 & agreement==1
replace nonproposer_acc_l = min(final_allocation_1,final_allocation_2) if proposer==3 & agreement==1
replace nonproposer_acc_h = max(final_allocation_1,final_allocation_2) if proposer_2==3 & agreement==0 & agreement2==1
replace nonproposer_acc_l = min(final_allocation_1,final_allocation_2) if proposer_2==3 & agreement==0 & agreement2==1

graph bar (mean) proposer_acc nonproposer_acc_h nonproposer_acc_l if agreement==1, by(treatment, note("")) over(round_bin, relabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30")) bar(1, fcolor(gs2)) bar(2, fcolor(gs6)) bar(3, fcolor(gs10)) b1title(Round) ytitle(Mean Allocation(€)) legend(row(1) order(1 "Proposer" 2 "Non-proposer, greater" 3 "Non-proposer, smaller") size(small)) blabel(bar, color(white) position(center) format(%2.0f)) scheme(s1mono) stack

*Figure 18
graph bar (mean) proposer_acc nonproposer_acc_h nonproposer_acc_l if id_in_group==1 & agreement==0 & agreement2==1, by(treatment, note("")) over(round_bin, relabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30")) bar(1, fcolor(gs2)) bar(2, fcolor(gs6)) bar(3, fcolor(gs10)) b1title(Round) ytitle(Mean Allocation(€)) legend(row(1) order(1 "Proposer" 2 "Non-proposer, greater" 3 "Non-proposer, smaller") size(small)) blabel(bar, color(white) position(center) format(%2.0f)) scheme(s1mono) stack

*footnote 22
by treatment: reg proposer_acc round if agreement==1, vce(cluster subject_id)
by treatment: reg nonproposer_acc_l round if agreement==1, vce(cluster subject_id)
by treatment: reg proposer_acc round if agreement==0 & agreement2==1, vce(cluster subject_id)
by treatment: reg nonproposer_acc_l round if agreement==0 & agreement2==1, vce(cluster subject_id)

*Figure 19
gen mwc_final = 0
replace mwc_final=1 if final_allocation_1==0 & final_allocation_2>0 & final_allocation_3>0
replace mwc_final=1 if final_allocation_2==0 & final_allocation_1>0 & final_allocation_3>0
replace mwc_final=1 if final_allocation_3==0 & final_allocation_1>0 & final_allocation_2>0
replace mwc_final=0 if final_allocation_1==0 & proposer==1 & agreement==1
replace mwc_final=0 if final_allocation_2==0 & proposer==2 & agreement==1
replace mwc_final=0 if final_allocation_3==0 & proposer==3 & agreement==1
replace mwc_final=0 if final_allocation_1==0 & proposer_2==1 & agreement2==1
replace mwc_final=0 if final_allocation_2==0 & proposer_2==2 & agreement2==1
replace mwc_final=0 if final_allocation_3==0 & proposer_2==3 & agreement2==1

graph bar (mean) proposer_acc nonproposer_acc_h if id_in_group==1 & mwc_final==1, by(treatment, note("")) over(round_bin, relabel(1 "1-5" 2 "6-10" 3 "11-15" 4 "16-20" 5 "21-25" 6 "26-30")) bar(1, fcolor(gs2)) bar(2, fcolor(gs6)) bar(3, fcolor(gs10)) b1title(Round) ytitle(Mean Allocation(€)) legend(row(1) order(1 "Proposer" 2 "Minimal winning coalition partner") size(small)) blabel(bar, color(white) position(center) format(%2.0f)) scheme(s1mono) stack
by treatment: reg proposer_acc round if id_in_group==1 & mwc_final==1, vce(cluster subject_id)

*footnote 24: OLS regressions
by treatment: reg proposer_acc round if id_in_group==1 & mwc_final==1, vce(cluster subject_id)

***Appendix D.4

*Table 7
by treatment: count if agreement==1
by treatment: count if agreement2==1
by treatment: count if agreement==0 & agreement2==0
*For treatment 3 (Automated Period 2), agreement in the second period is automatic

***End***
